# !/usr/bin python3
# encoding: utf-8 -*-
# @file     : goods_apis.py
# @author   : 沙陌 Matongxue_2
# @Time     : 2024/1/4 20:59
# @Copyright: 北京码同学
from api.base_api import BaseSellerApi


class AddGoodsApi(BaseSellerApi):

    def __init__(self):
        super().__init__()
        self.url = f'{self.host}/seller/goods'
        self.method = 'post'
        self.json = {
            "brand_id": "",
            "category_id": 83,
            "category_name": "",
            "goods_name": "沙陌炒锅-20231114班",
            "sn": "sn001",
            "price": "199",
            "mktprice": "189",
            "cost": "30",
            "weight": "1",
            "goods_gallery_list": [{
                "img_id": -1,
                "original": "http://59.36.173.55:7000/statics/attachment/goods/2024/1/4/21/00544529.png",
                "sort": 0
            }],
            "quantity": 99999999,
            "goods_transfee_charge": 1,
            "has_changed": 0,
            "market_enable": 1,
            "template_id": 0,
            "exchange": {
                "category_id": "",
                "enable_exchange": 0,
                "exchange_money": 0,
                "exchange_point": 0
            },
            "shop_cat_id": 0,
            "meta_description": "",
            "meta_keywords": "",
            "page_title": "",
            "goods_params_list": [],
            "sku_list": [],
            "intro": "<p>商品说明</p>"
        }

class GoodsUnderApi(BaseSellerApi):

    def __init__(self,goods_ids:list):
        super().__init__()
        # goods_ids=[111,222,333]
        # /seller/goods/111,222,333/under
        # 我们需要把传进来的[111,222,333] 变成 111,222,333 的字符串
        goods_ids = ','.join([str(i) for i in goods_ids])
        self.url = f'{self.host}/seller/goods/{goods_ids}/under'
        self.method = 'put'
        self.data = {
            "reason":"没啥理由"
        }

class GoodsRecycleApi(BaseSellerApi):

    def __init__(self,goods_ids:list):
        super().__init__()
        # goods_ids=[111,222,333]
        # /seller/goods/111,222,333/under
        # 我们需要把传进来的[111,222,333] 变成 111,222,333 的字符串
        goods_ids = ','.join([str(i) for i in goods_ids])
        self.url = f'{self.host}/seller/goods/{goods_ids}/recycle'
        self.method = 'put'

class GoodsDeleteApi(BaseSellerApi):

    def __init__(self,goods_ids:list):
        super().__init__()
        # goods_ids=[111,222,333]
        # /seller/goods/111,222,333/under
        # 我们需要把传进来的[111,222,333] 变成 111,222,333 的字符串
        goods_ids = ','.join([str(i) for i in goods_ids])
        self.url = f'{self.host}/seller/goods/{goods_ids}'
        self.method = 'delete'
